Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
unicode-properties
Advanced tools
The unicode-properties npm package provides utilities for querying properties of Unicode characters. It allows developers to determine various attributes of Unicode characters, such as their general category, script, and whether they are whitespace, punctuation, etc.
Get General Category
This feature allows you to get the general category of a Unicode character. In the example, the character 'A' is queried, and the output is 'Lu', which stands for 'Letter, Uppercase'.
const unicode = require('unicode-properties');
const category = unicode.getCategory('A');
console.log(category); // Output: 'Lu'
Check if Character is Alphabetic
This feature checks if a given Unicode character is alphabetic. In the example, the character 'A' is checked, and the output is true.
const unicode = require('unicode-properties');
const isAlphabetic = unicode.isAlphabetic('A');
console.log(isAlphabetic); // Output: true
Get Script of Character
This feature allows you to get the script of a Unicode character. In the example, the character 'あ' is queried, and the output is 'Hiragana'.
const unicode = require('unicode-properties');
const script = unicode.getScript('あ');
console.log(script); // Output: 'Hiragana'
Check if Character is Whitespace
This feature checks if a given Unicode character is a whitespace character. In the example, the space character is checked, and the output is true.
const unicode = require('unicode-properties');
const isWhitespace = unicode.isWhitespace(' ');
console.log(isWhitespace); // Output: true
The unicode-trie package is used for efficient storage and lookup of Unicode character properties using a trie data structure. It is more specialized for performance and may be used in conjunction with other packages for full Unicode property querying.
The unicode-12.1.0 package provides Unicode data for version 12.1.0 of the Unicode standard. It includes data files and utilities for working with Unicode properties, but it may not be as user-friendly or feature-rich as unicode-properties.
Provides fast access to unicode character properties. Uses unicode-trie to compress the properties for all code points into just 9.5KB. Currently, unicode-properties supports Unicode version 12.
npm install unicode-properties
var unicode = require('unicode-properties');
unicode.getCategory('2'.charCodeAt()) //=> 'Nd'
unicode.getNumericValue('2'.charCodeAt()) //=> 2
Returns the unicode general category for the given code point.
Returns the script for the given code point.
Returns the canonical combining class for the given code point.
Returns the East Asian width for the given code point.
Returns the numeric value for the given code point, or null if there is no numeric value for that code point.
Returns whether the code point is an alphabetic character.
Returns whether the code point is a digit.
Returns whether the code point is a punctuation character.
Returns whether the code point is lower case.
Returns whether the code point is upper case.
Returns whether the code point is title case.
Returns whether the code point is whitespace: specifically, whether the category is one of Zs, Zl, or Zp.
Returns whether the code point is a base form. A code point of base form does not graphically combine with preceding characters.
Returns whether the code point is a mark character (e.g. accent).
MIT
FAQs
Provides fast access to unicode character properties
We found that unicode-properties demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.